package com.txx.myspringboot.ioc.ann;

import com.txx.myspringboot.ioc.Bean.Animal;
import com.txx.myspringboot.ioc.Bean.Cat;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.stereotype.Component;

/**
 * 3.@Component + 实现FactoryBean来向容器注入bean
 */
@Component
public class MyCat implements FactoryBean<Animal> {
    @Override
    public Animal getObject() throws Exception {
        return new Cat();
    }

    @Override
    public Class<?> getObjectType() {
        return Cat.class;
    }
}
